package com.gaofeng.day19;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Consumer;

public class demo02 {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("gj","黄蓉");
        map.put("wxb","建宁公主");
        map.put("yinzhip","小龙女");
        System.out.println(map);

        Set<String> keys = map.keySet();

        for (String key : keys) {
            System.out.println(key + " = " + map.get(key));
        }

        keys.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
//                System.out.println(s);
                System.out.println(s +" => " + map.get(s));
            }
        });


        keys.forEach(s ->  System.out.println(s + "====" + map.get(s)));

        Set<Entry<String, String>> entries = map.entrySet();
        entries.forEach(data -> {
            System.out.println(data.getKey() + data.getValue());
        });
    }
}
